In [1]:
import plotly.plotly as py
import plotly.graph_objs as go
import pandas
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
import matplotlib.ticker as ticker
from scipy.stats import gaussian_kde
import matplotlib.image as mpimg
In [2]:
files = [
'Cluster-Crime-Janeiro', 'Cluster-Crime-Fevereiro',
'Cluster-Crime-Marco', 'Cluster-Crime-Abril',
'Cluster-Crime-Maio'
]
qtd_ocorrencias = []
meses = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio']
for file in files:
df = pandas.read_csv("./data/" + file + ".csv")
qtd_ocorrencias.append(len(df))
data = [go.Bar(
x=meses,
y=qtd_ocorrencias
)]
py.iplot(data, filename='basic-bar')
Out[2]:
In [3]:
img=mpimg.imread('crimes_por_mês.png')
imgplot = plt.imshow(img)
plt.show()
In [4]:
labels = meses
values = qtd_ocorrencias
trace = go.Pie(labels=labels, values=values)
py.iplot([trace], filename='basic_pie_chart')
Out[4]:
In [5]:
img=mpimg.imread('crimes_por_mês_per.png')
imgplot = plt.imshow(img)
plt.show()
In [ ]: